
#import "FAMNavigationViewController.h"

@interface FAMNavigationViewController ()

@end

@implementation FAMNavigationViewController
+ (void)initialize{
    [[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    [[UINavigationBar appearance] setShadowImage:[UIImage new]];
    [UINavigationBar appearance].titleTextAttributes = @{
        NSFontAttributeName:[UIFont systemFontOfSize:20],
        NSForegroundColorAttributeName:kBlackColor
    };
    [UINavigationBar appearance].barTintColor = kWhiteColor;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.fd_interactivePopDisabled = YES;
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    if (self.childViewControllers.count > 0) {
        UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
        backButton.frame = CGRectMake(0, 0, 44, 44);
        [backButton setImage:[UIImage imageNamed:@"general_back"] forState:UIControlStateNormal];
        [backButton setImage:[UIImage imageNamed:@"general_back"] forState:UIControlStateSelected];
        [backButton setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 15)];
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backButton];
        if ([viewController isKindOfClass:[FAMCameFoodResultViewController class]]) {
            [backButton addTarget:self action:@selector(FAM_backButtonNextPageClick:) forControlEvents:UIControlEventTouchUpInside];
        }else{
            [backButton addTarget:self action:@selector(FAM_backButtonClick:) forControlEvents:UIControlEventTouchUpInside];
        }
        viewController.hidesBottomBarWhenPushed = YES;
    }else{
        viewController.hidesBottomBarWhenPushed = NO;
    }
    [super pushViewController:viewController animated:animated];
}
- (void)FAM_backButtonClick:(UIButton *)sender{
    [self popViewControllerAnimated:YES];
}

- (void)FAM_backButtonNextPageClick:(UIButton *)sender{
    NSArray *array = [self popToViewController:self.childViewControllers[1] animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
@end
